#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;

class unionset
{
public:
    vector<int> f;
    unionset(int n)
    {
        for (int i = 0; i <= n; i++) f.push_back(i);
    }
    int find(int n)
    {
        return f[n] == n ? n : f[n] = find(f[n]);
    }
    void merge(int a, int b)
    {
        f[find(b)] = find(a);
    }
};
int arr[200005];
unordered_map<int, vector<int>> ma;

int main()
{
    int n, m, k; cin >> n >> m >> k;
    unionset s(n);
    int num = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
    }
    for (int i = 0; i < m; i++)
    {
        int a, b; cin >> a >> b;
        s.merge(a, b);
    }
    for (int i = 1; i <= n; i++)
    {
        int temp = s.f[i];
        ma[s.find(temp)].push_back(arr[i]);
    }
    for (auto& x : ma)
    {
        unordered_map<int, int> m;
        for (auto& y : x.second)
        {
            m[y] += 1;
        }
        int ans = 0;
        for (auto& y : m) ans = max(ans, y.second);
        num += x.second.size() - ans;
    }
    cout << num << endl;
    return 0;
}